var kejiecesu
var yijiecisu

function jisuanshijian(){
  $.each(duzhezhen, (index, item) => {
    $.each(duzhe, (index, item2) => {
      if(item.quanxian==item2.quan){
        let c=parseInt(item.banzenriqi.substring(5, 7))+parseInt(item2.duzheyouxiaoqi)
        let j=item.banzenriqi.substring(0, 4)
        let p=item.banzenriqi.substring(8, 10)
           if(c>12){
             let q=Math.floor(parseInt(c/12))   
           j=parseInt(item.banzenriqi.substring(0, 4))+q
           c=c-q*12
           console.log(c);
           }
           if(c<10){
            if(c=0){
              c=1
            }
             c="0"+c
           }
          
           item.kadaoqi=j+"-"+c+"-"+p
      }
                    })
  })
}

function jisuansuji(){
  let c=0
  $.each(jieshuarr,(index,item3)=>{
    if(item3.zhuangtai=="借出"){
     c++
    }else if(item3.zhuangtai=="归还"){
      c--
    }
    $.each(duzhezhen,(index,item4)=>{
      $.each(duzhe,(index,item5)=>{
if(item3.xingmin==item4.xingmin){
  if(item4.quanxian==item5.quan){
    yijiecisu=c
  kejiecesu=item5.kejiecesu-c
  }
}
      })
  })
})
}
function jisuyhsj(){
  $.each(jieshuarr,(index,item3)=>{
    $.each(duzhezhen,(index,item4)=>{
      $.each(duzhe,(index,item5)=>{
if(item3.xingmin==item4.xingmin){
  if(item4.quanxian==item5.quan){
    let c=parseInt(item3.jieshushijian.substring(5, 7))+parseInt(item5.kejieyuesu)
    let j=item3.jieshushijian.substring(0, 4)
    let p=item3.jieshushijian.substring(8, 10)
    if(c>12){
      let q=Math.floor(parseInt(c/12))   
    j=parseInt(item3.jieshushijian.substring(0, 4))+q
    c=c-q*12
    }
    if(c<10){
     if(c==0){
       c=1
     }
      c="0"+c
    }
    item3.yinghuanshijian=j+"-"+c+"-"+p
  }
}
      })
  })
})
}
function yuqiweihuan(){
  $.each(jieshuarr, (index, item) => {
    a = item.yinghuanshijian.substring(0, 4)
    b = item.yinghuanshijian.substring(5, 7)
    c = item.yinghuanshijian.substring(8, 10)
    e = item.guihuashijian.substring(0, 4)
    f = item.guihuashijian.substring(5, 7)
    g = item.guihuashijian.substring(8, 10)
   if(a<e){
    item.yuqiguihuan=1
   }else if(a==e){
     if(b<f){
      item.yuqiguihuan=1
     }else if(b==f){
       if(c<g){
        item.yuqiguihuan=1
       }
     }
   }

  })
}